<template>
  <div class="confirmOrder">
    <div class="pageHeader">
      确认新订单
    </div>

    <div class="msg acea-row row-middle">
      <van-icon name="info" size="16" color="#ff4500" />
      <p style="flex:1">如确认订单，请及时在APP端操作状态</p>
      <!-- <a href="https://xiaobaiqiu.com/mobile/appinfo" style="color:#ff4500">去下载</a> -->
    </div>

    <div class="part01">
      <div class="item acea-row row-middle row-between">
        <span>预订人</span>
        <div class="acea-row row-middle ">
          <span style="margin-right:10px">{{orderDetail.member_phone}}({{orderDetail.player_num}}人)</span>
          <van-icon name="orders-o" size="16" @click="memberList = true"/>
        </div>
      </div>
      <!-- <div class="item acea-row row-middle row-between">
        <span>嘉宾价</span>
        <div class="acea-row row-middle ">
          <span>￥650 x 5</span>
        </div>
      </div> -->
      <div class="item acea-row row-middle row-between">
        <span class="totalPriceTitle">总价</span>
        <div class="acea-row row-middle ">
          <span class="totalPrice">￥{{orderDetail.total_price}}</span>
        </div>
      </div>
    </div>

    <div class="part02">
      <div class="title">订单信息</div>
      <div class="container">
        <div class="item item01 acea-row row-middle row-between">
          <p>订单编号：{{orderDetail.order_number}}</p>
          <span style="color:#1989fa" v-clipboard:copy="orderDetail.order_number" v-clipboard:success="copySuccess">复制</span>
        </div>
        <div class="item item02 acea-row row-middle">
          <p class="itemName">T-time</p>
          <div class="acea-row row-column">
            <p class="time">{{orderDetail.play_time | changeTime}}</p>
            <span style="color:red">如需改签请在APP上申请</span>
          </div>
        </div>
        <div class="item">
          <van-steps direction="vertical" active-color="#1989fa" :active="0">
            <van-step>
              <h3>等待确认订单</h3>
              <p>{{orderDetail.createtime | changeTime}}</p>
            </van-step>
            <van-step>
              <h3>待下场</h3>
            </van-step>
            <van-step>
              <h3>待完成</h3>
            </van-step>
          </van-steps>
        </div>
      </div>
    </div>

    <a :href="'tel:'+orderDetail.member_phone" class="footer acea-row row-middle row-center">
      <van-icon name="audio" size="18" />
      <span>联系预订人</span> 
    </a>

    <div class="memberList">
      <van-dialog v-model="memberList" title="预订" :showConfirmButton="false" :closeOnClickOverlay="true">
        <ul>
          <li v-for="(item,index) in orderDetail.player " :key="index">
            <span v-if="item.is_vip == 0">嘉宾</span>
            <span v-else-if="item.is_vip == 1" style="background: #6ECF9D">会员</span>
            {{ item.name }}
            {{ item.telphone }}
          </li>
        </ul>
      </van-dialog>
    </div>
  </div>
</template>

<script>
import Vue from 'vue';
import api from 'api'
import moment from 'moment'
import config from 'api/config.js'
import { Step, Steps , Dialog , Icon, Toast } from 'vant';
Vue.use(Step);
Vue.use(Steps);
Vue.use(Dialog);
Vue.use(Icon);


export default {
  data() {
    return {
      routerUrl:config.routerUrl,
      memberList:false,
      orderDetail:{
        player:[]
      }
    }
  },
  created() {
    this.getDetail()
  },
  methods: {
    getDetail(){
      let order_id = this.$route.params.id
      this.order_id = order_id
      Toast.loading({message:"加载中...",duration:5000})
      api.get("/notice/orderConfirm",{order_id}).then(e=>{
        this.orderDetail = e.data
        Toast.clear()
      })
    },
    copySuccess(){
      Toast("复制成功")
    }
  },
  filters:{
    changeTime(e){
      return moment(e*1000).format("YYYY-MM-DD HH:mm:ss")
    }
  }
}
</script>

<style scoped>
  .confirmOrder{
    min-height: 100vh;
    background-color: #f2f3f5;
    position: relative;
  }
  .msg{
    padding: 0 10px;
    margin-top: 20px;
  }
  .msg p {
    flex: 1;
    margin-left: 10px;
  }
  .part01{
    margin-top: 20px;
    padding: 20px;
    font-size: 26px;
    background-color: #ffffff;
  }
  .part01 .item{
    margin-bottom: 30px;
  }
  .part01 .item:last-of-type{
    margin-bottom: 0;
  }
  .part01 .item .totalPriceTitle{
    font-size: 30px;
    color: #1989fa;
  }
  .part01 .item .totalPrice{
    font-size: 30px;
    color: #ff4500;
  }
  .part02{
    padding: 20px;
    background-color: #ffffff;
    font-size: 26px;
    margin-top: 20px;
  }
  .part02 .title{
    font-size: 32px;
  }
  .part02 .container{
    margin-top: 50px;
  }
  .part02 .item{
    margin-bottom: 20px;
  }
  .part02 .item:last-of-type{
    margin-bottom: 0px
  }
  .part02 .item02 .itemName{
    margin-right: 20px;
    color: #7e8c8d;
  }
  .part02 .item02 .time{
    font-size: 32px;
    margin-bottom: 10px;
  }
  .footer{
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 90px;
    font-size: 26px;
    background-color: #2d8aea;
    color: #ffffff;
  }
  .footer span{
    margin-left: 20px;
    margin-top: 4px;
  }

  .memberList >>> .van-dialog__content{
    max-height: 240px;
    overflow-y: auto;
    padding: 0 10px;
  }
  .alertContent >>> .van-dialog__header , .memberList >>> .van-dialog__header {
    padding: 10px 0;
    background: #F2F3F5;
  }

  .memberList ul {
    padding-bottom: 20px;
  }

  .memberList li {
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 80px;
    background: #ffffff;
    border-bottom: 1px solid #cccccc;
  }

  .memberList li span {
    width: 80px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    color: #ffffff;
    background: #cccccc;
    font-size:28px;
    border-radius: 10px;
    margin-right: 10px;
  }
</style>